#!/bin/sh

##################### restart socket #############################
PID_RANK=$(ps -ef | grep seat_work_server.py | grep -v grep | awk '{print $2}' | xargs)
if [ "$PID_RANK" != "" ]; then
  echo "-----Force kill current server process"
  kill -9 $PID_RANK
fi

nohup python3 /home/admin/app/internal_server/seat_work_server.py >>seat_work_server.log 2>&1 &

################## check if server startup ##########################
PID_RANK=$(ps -ef | grep seat_work_server.py | grep -v grep | awk '{print $2}')

if [ "$PID_RANK" == "" ]; then
  echo "startup fail please check log file."
  exit 1
fi

echo "startup seat_work_server success!!!"
